package algorithms.leecode;

import java.util.ArrayList;
import java.util.List;

public class Au78 {
    public static void main(String[] args) {
        new Au78().subsets(new int[]{1,2,3});
    }
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> list = new ArrayList<>();
        List<Integer> tmp = new ArrayList<>();
        getResult(list,0,nums,tmp);
        return list;
    }

    public void getResult(List<List<Integer>> list,int currIndex,int[] nums,List<Integer> tmp) {
        list.add(tmp);
        for (int i = currIndex ; i < nums.length; i++) {
            List<Integer> list1 = new ArrayList<>();
            list1.addAll(tmp);
            list1.add(nums[i]);
            getResult(list,i + 1,nums,list1);

        }
    }
}
